<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>个人中心</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <style>
        html,
        body {
            width: 100%;
            min-height: 100%;
            background: #eee;
        }

        #app{
          padding-top:0.5rem;
        }
        /*结果集*/

        .result_box {
            background: #fff;
            margin-top: 0.5rem;
        }

        .sort_list {
            padding: 0.45rem 0;
            background-color: #fff;
            display: flex;
            align-items: center;
            position: relative;
        }

        .sort_list::after {
            content: "";
            height: 1px;
            width: calc(100% - 0.75rem);
            position: absolute;
            background: #edeae8;
            bottom: 0;
            left: 0.75rem;
        }

        .sort_list .num_logo {
            width: 1.5rem;
            margin: 0rem 0.75rem;
        }

        .sort_list .num_name {
            font-size: 0.8rem;
            color: #333;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="result_box">
            <div v-for="info in list_info" class="sort_list">
                <div class="num_logo">
                    <div :style="'background:url('+info.head_img+') center/cover no-repeat;width:1.5rem;height:1.5rem;'"></div>
                </div>
                <div v-if="info.username" class="num_name">{{info.username}}</div>
                <div v-else class="num_name">该用户很懒，没有填写名字</div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript">
    apiready = function() {

        // 实例化vue 渲染我的下级数据
        var my_xj = new Vue({
            el: "#app",
            data: {
                list_info: []
            },
            created: function() {

            },
            mounted: function() {
                var $this = this;
                $this.get_list();
            },
            methods: {
                // 获取列表数据
                get_list: function() {
                    var $this = this;
                    api.showProgress({
                        style: 'default',
                        animationType: 'fade',
                        title: '努力加载中...',
                        text: '先喝杯茶...',
                        modal: false
                    });

                    api.ajax({
                        url: window.Url.Freeucenter_junior,
                        method: 'post',
                        data: {
                            values: {
                                token: $api.getStorage('token')
                            }
                        }
                    }, function(ret, err) {
                        api.hideProgress();

                        if (ret) {
                            console.log(JSON.stringify(ret));

                            if (ret.re == 1) {
                                $this.list_info = ret.data;
                                console.log(JSON.stringify($this.list_info));
                            } else {
                                api.toast({
                                    msg: '暂无我的下级',
                                    duration: 2000,
                                    location: 'bottom'
                                });

                            }

                        } else {
                            console.log(JSON.stringify(err));
                        }
                    });


                }
            }
        })

    };
</script>

</html>
